package com.guangzhi.weijianzhi.company.manager;

import java.util.ArrayList;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ListView;

import com.guangzhi.weijianzhi.R;
import com.guangzhi.weijianzhi.adapter.ComMangAdapter;
import com.guangzhi.weijianzhi.entity.ComMangEntity;
import com.guangzhi.weijianzhi.fragment.BaseFragment;

public class ComapnyMangFragment extends BaseFragment implements OnClickListener {

	private ArrayList<ComMangEntity> entitys = new ArrayList<ComMangEntity>();
	
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		for (int i = 0; i < 4; i++) {
			entitys.clear();
			entitys.add(new ComMangEntity());
		}
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		View view = View.inflate(getActivity(), R.layout.tz_com_mang_layout, null);
		initView(view);
		return view;
	}
	
	private void initView(View view) {
		// TODO Auto-generated method stub
		initTitle(view);
		titleTextV.setText("微工作");
		goBack.setCompoundDrawables(null, null, null, null);
		goBack.setText("消息");
		titleRightBtn2.setText("历史职位");
		
		view.findViewById(R.id.publish_position).setOnClickListener(this);
		
		
		ListView lv = (ListView) view.findViewById(R.id.con_mang_lv);
		  ComMangAdapter mAdapter = new ComMangAdapter(getActivity());
		lv.setAdapter(mAdapter);
		  mAdapter.onBoundData(entitys);
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onActivityCreated(savedInstanceState);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.publish_position:
			Intent intent = new Intent(getActivity(), PublishPositionActivity.class);
			startActivity(intent);
			break;

		default:
			break;
		}
	}
}
